package base.widgets;

import org.redr.canvas.OSPath;
import org.redr.canvas.RRW;
import org.redr.canvas.RedRApplication;
import org.redr.canvas.utils.OutputSocketDataException;
import org.redr.widgetGUI.core.RedRWidgetGUI;
import org.redr.widgetGUI.core.WidgetLabel;
import org.redr.widgetGUI.settings.WidgetSettings;

import base.signals.RDataFrameOutput;

public class IrisData extends RRW{
	public static final String name = "Iris";
	public static final String summary = "Iris Data";
	public static final String details = "Sends the iris data as a test.";
	public static final String icon = OSPath.join(RedRApplication.parentDir, "coreIcons", "default.png").getAbsolutePath();
    
	public IrisData(WidgetSettings ws) {
		super(ws);
		this.sendIrisData();
	}

	@Override
	protected void initSignals() {
		// TODO Auto-generated method stub
		this.addOutput(new RDataFrameOutput(this, "id1", _("Iris Data")));
	}

	@Override
	protected void initGUI() {
		// TODO Auto-generated method stub
		new WidgetLabel(this.gui, (WidgetSettings) this.settings.getSettings("mainLabel")
				.setSetting("label", "This widget sends the iris data as a test."));
		
	}

	@Override
	protected void dataInput(String id, Object data, String widgetId) {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void initVariables() {
		// TODO Auto-generated method stub
		
	}
	
	private void sendIrisData(){
		try {
			this.outputsGet("id1").setData("iris");
		} catch (OutputSocketDataException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return;
		}
		this.send("id1");
	}

}
